home *** CD-ROM | disk | FTP | other *** search
/ Aminet 22 / Aminet 22 (1997)(GTI - Schatztruhe)[!][Dec 1997].iso / Aminet / game / gag / SnoOow.lha / SnoOow.E < prev    next >
Text File  |  1997-09-15  |  4KB  |  168 lines

  1. PROC main()
  2.     DEF    max,left,width,upper,height,bwidth,wind,
  3.             teml,rdargs,win,x,t,sts,run,
  4.             args=NIL:PTR TO LONG,
  5.             sx[5000]:ARRAY OF LONG,
  6.             sy[5000]:ARRAY OF LONG
  7.  
  8.     max:=100
  9.     wind:=0
  10.     left:=270
  11.     width:=100
  12.     upper:=50
  13.     height:=100
  14.     bwidth:=16
  15.     run:=TRUE
  16.  
  17.     IF wbmessage=NIL
  18.         teml:='FILE/M'
  19.         rdargs:=ReadArgs(teml,{args},NIL)
  20.         IF rdargs
  21.             IF args
  22.                 x:=0
  23.                 WHILE args[x]
  24.                     UpperStr(args[x])
  25.                     IF StrCmp(args[x],'/?',ALL)
  26.                         WriteF('SnoOow! V1.1\n')
  27.                         WriteF('Usage: SnoOow <INFO> <MAX=n> <WIND=n> <LEFT=n> <UPPER=n> <WIDTH=n> <HEIGHT=n> <BWIDTH=n>\n\n')
  28.                         x++
  29.                         run:=FALSE
  30.                     ELSEIF StrCmp(args[x],'INFO',ALL)
  31.                         WriteF('+-------------------------------+\n')
  32.                         WriteF('|             SnoOow!           |\n')
  33.                         WriteF('>-------------------------------<\n')
  34.                         WriteF('| Written by Jesper Wilhelmsson |\n')
  35.                         WriteF('|                               |\n')
  36.                         WriteF('| This program is ublic Domain  |\n')
  37.                         WriteF('|   Do with it as you please!   |\n')
  38.                         WriteF('| Send comments to:             |\n')
  39.                         WriteF('|               jive@algonet.se |\n')
  40.                         WriteF('+-------------------------------+\n')
  41.                         x++
  42.                         run:=FALSE
  43.                     ELSEIF StrCmp(args[x],'MAX',ALL)
  44.                         x++
  45.                         IF args[x]
  46.                             max:=Val(args[x])
  47.                             IF max<1 THEN max:=1
  48.                             IF max>5000 THEN max:=5000
  49.                             x++
  50.                         ENDIF
  51.                     ELSEIF StrCmp(args[x],'WIND',ALL)
  52.                         x++
  53.                         IF args[x]
  54.                             wind:=Val(args[x])
  55.                             IF wind<-4 THEN wind:=-4
  56.                             IF wind>4 THEN wind:=4
  57.                             x++
  58.                         ENDIF
  59.                     ELSEIF StrCmp(args[x],'LEFT',ALL)
  60.                         x++
  61.                         IF args[x]
  62.                             left:=Val(args[x])
  63.                             x++
  64.                         ENDIF
  65.                     ELSEIF StrCmp(args[x],'UPPER',ALL)
  66.                         x++
  67.                         IF args[x]
  68.                             upper:=Val(args[x])
  69.                             x++
  70.                         ENDIF
  71.                     ELSEIF StrCmp(args[x],'WIDTH',ALL)
  72.                         x++
  73.                         IF args[x]
  74.                             width:=Val(args[x])
  75.                             x++
  76.                         ENDIF
  77.                     ELSEIF StrCmp(args[x],'HEIGHT',ALL)
  78.                         x++
  79.                         IF args[x]
  80.                             height:=Val(args[x])
  81.                             x++
  82.                         ENDIF
  83.                     ELSEIF StrCmp(args[x],'BWIDTH',ALL)
  84.                         x++
  85.                         IF args[x]
  86.                             bwidth:=Val(args[x])
  87.                             x++
  88.                         ENDIF
  89.                     ELSE
  90.                         x++
  91.                     ENDIF
  92.                 ENDWHILE
  93.             ENDIF
  94.             FreeArgs(rdargs)
  95.         ENDIF
  96.     ENDIF
  97.     IF run
  98.         win:=OpenW(left,upper,width,height,$240,$1002,'',NIL,1,NIL)
  99.         prepScreen(width,height,bwidth)
  100.         sts:=0
  101.  
  102.         FOR x:=0 TO max-1
  103.             sx[x]:=Rnd(width-10)+5
  104.             sy[x]:=Rnd(height-25)-height
  105.         ENDFOR
  106.  
  107.         WHILE sts<height
  108.             IF sts>0 THEN sts:=sts+1
  109.             FOR x:=0 TO max-1
  110.                 IF sy[x]>bwidth THEN Plot(sx[x],sy[x],0)
  111.                 sy[x]:=sy[x]+1
  112.                 IF sy[x]>bwidth
  113.                     t:=Rnd(3+wind)-1
  114.                     IF ReadPixel(stdrast,sx[x]+t,sy[x])=0 THEN sx[x]:=sx[x]+t
  115.                     IF (ReadPixel(stdrast,sx[x],sy[x]+1)<>0) AND (ReadPixel(stdrast,sx[x],sy[x]+2)<>0)
  116.                         IF ReadPixel(stdrast,sx[x]+1,sy[x]+1)=0
  117.                             sx[x]:=sx[x]+1
  118.                         ELSEIF ReadPixel(stdrast,sx[x]-1,sy[x]+1)=0
  119.                             sx[x]:=sx[x]-1
  120.                         ELSE
  121.                             Plot(sx[x],sy[x],2)
  122.                             IF sts=0
  123.                                 IF sy[x]=(bwidth+4)
  124.                                     prepScreen(width,height,bwidth)
  125.                                     FOR x:=0 TO max-1
  126.                                         sx[x]:=Rnd(width-10)+5
  127.                                         sy[x]:=Rnd(height-25)-height
  128.                                     ENDFOR
  129.                                 ELSE
  130.                                     sy[x]:=bwidth
  131.                                     sx[x]:=Rnd(width-10)+5
  132.                                 ENDIF
  133.                             ELSE
  134.                                 sy[x]:=-2*height
  135.                             ENDIF
  136.                         ENDIF
  137.                     ENDIF
  138.                 ENDIF
  139.                 IF sy[x]>bwidth THEN Plot(sx[x],sy[x],2)
  140.             ENDFOR
  141.             IF Mouse()=%011 THEN sts:=1
  142.             WaitTOF()
  143.         ENDWHILE
  144.         CloseW(win)
  145.     ENDIF
  146. ENDPROC
  147.  
  148. PROC prepScreen(width,height,bwidth)
  149.     DEF x,y,w,h
  150.  
  151.     w:=width/2-30
  152.     h:=height/2+4
  153.  
  154.     Box(3,bwidth,width-3,height-3,0)
  155.     Colour(3)
  156.     TextF(w,h,'SnoOow!')
  157.     FOR x:=w TO w+53
  158.         FOR y:=h-9 TO h+1
  159. /*            IF (ReadPixel(stdrast, x + 1, y) = 3) AND (ReadPixel(stdrast, x, y) = 0) THEN Plot(x, y, 1)
  160. */            IF (ReadPixel(stdrast, x - 1, y) = 3) AND (ReadPixel(stdrast, x, y) = 0) THEN Plot(x, y, 1)
  161. /*            IF (ReadPixel(stdrast, x, y + 1) = 3) AND (ReadPixel(stdrast, x, y) = 0) THEN Plot(x, y, 1)
  162. */            IF (ReadPixel(stdrast, x, y - 1) = 3) AND (ReadPixel(stdrast, x, y) = 0) THEN Plot(x, y, 1)
  163.         ENDFOR
  164.     ENDFOR
  165. ENDPROC
  166.  
  167. CHAR '$VER: SnoOow V1.1 (97.09.15)'
  168.